import { getWidgetByName } from '@/widgets/config';

export default {
  name: 'WidgetBuilder',
  functional: true,
  render: function (createElement, context) {
    const { params } = context.props;
    return createElement(getWidgetByName(params.type), {
      ...context.data,         // 遍历context.data对象，将props属性覆盖到context.data
      props: params.props
    }, context.children);
  },
  props: {
    params: Object
  }
}